<template>
  <div class="container">
    <div class="header">
      <van-nav-bar
        title="个人中心"
        left-text="返回"
        right-text="退出"
        left-arrow
        @click-left="$router.go(-1)"
        @click-right="onClickRight"
      />
    </div>
    <div class="content">
      <van-cell-group inset title="个人中心">
        <van-cell title="地址管理" is-link to="/address" />
        <van-cell title="订单中心" is-link to="/order" />
      </van-cell-group>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { useUserStore } from '@/stores/user'
import { useRouter } from 'vue-router'
const userStore = useUserStore()
const router = useRouter()
const onClickRight = () => {
  // 清空用户数据
  userStore.setUserId('')
  localStorage.removeItem('token')
  // 跳转回首页
  router.push('/')
}
</script>

<style lang="scss" scoped>
.container {
  .content {
    padding-top: 15px;
  }
}
</style>
